//
//  UILabel+MKLabel.m
//  Weibo_OC
//
//  Created by mac on 16/1/16.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "UILabel+MKLabel.h"

@implementation UILabel (MKLabel)

- (instancetype)initWithTitle:(NSString *)title andWithTitleColor:(UIColor *)color andWithFontSize:(CGFloat)size {
    if (self = [super init]) {
        self.text = title;
        self.textAlignment = NSTextAlignmentCenter;
        self.textColor = color;
        self.font = [UIFont systemFontOfSize:size];
        self.numberOfLines = 0;
        [self sizeToFit];
    }
    
    return self;
}

- (instancetype)initWithTitle:(NSString *)title andWithTitleColor:(UIColor *)color andWithFontSize:(CGFloat)size andWithMargin:(CGFloat)margin {
    
    if (self = [super init]) {
        self = [self initWithTitle:title andWithTitleColor:color andWithFontSize:size];
        
        self.preferredMaxLayoutWidth = [UIScreen mainScreen].bounds.size.width - 2 * margin;
        self.textAlignment = NSTextAlignmentLeft;
    }
    
    return  self;

}

@end
